package b2.widget.status
{
	import b2.config.*;
	import b2.net.*;
	import b2.player.*;
	import b2.scene.*;
	import b2.util.BFont;
	
	import flash.display.*;
	import flash.events.*;
	import flash.filters.*;
	import flash.text.*;
	import flash.ui.Mouse;
	import flash.geom.Point;
	
	public class StatusIcon extends Sprite
	{
		public var itemTip:StatusIconMessage;
		public var index:int;
		protected var statusInfo:StatusInfo;
		private var suffixText:TextField;
		private var tipText:TextField;
		
		public function StatusIcon(statusInfo:StatusInfo)
		{
			this.statusInfo = statusInfo;
			var statusConfig:StatusConfig = Config.statusConfigs[statusInfo.statusIndex];
			var IcoImage:Class = ResourceHelper.getInstance().getClassByName(statusConfig.statusImage);
			var ico:Sprite = new IcoImage();
			addChild(ico)
			suffixText = new TextField();
			suffixText.selectable = false;
    		suffixText.autoSize = TextFieldAutoSize.LEFT;
			suffixText.defaultTextFormat = new TextFormat("微软雅黑", 12, 0xFFFFFF);
//			suffixText.filters = [new GlowFilter(0xFFFFFF, 1, 1.2, 1.2, 100, BitmapFilterQuality.HIGH)];
			suffixText.y = 20;
			addChild(suffixText);
			tipText = new TextField();
			tipText = new TextField();
			tipText.selectable = false;
    		tipText.autoSize = TextFieldAutoSize.CENTER;
			tipText.defaultTextFormat = new TextFormat("΢微软雅黑", 12, 0x000000);
			tipText.filters = [new GlowFilter(0xFFFFFF, 1, 1.2, 1.2, 100, BitmapFilterQuality.HIGH)];
			tipText.y = 40;
			addChild(tipText);
			refresh();
		}
		
		
		public function refresh():void
		{
			this.x = index * StatusBar.EVERY_WIDTH;
			suffixText.text = statusInfo.currentRequiredValue.toString();
			tipText.text = "+" + statusInfo.currentBonus / 10 + "%";
			suffixText.x = 38 - suffixText.width;
			tipText.x = 20 - tipText.width / 2;
		}
	}
}